home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / clipEditorRegisterActions.me < prev    next >
Encoding:
Text File  |  2003-07-17  |  4.2 KB  |  140 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. // Copyright (C) 1997-1999 Alias|Wavefront,
  18. // a division of Silicon Graphics Limited.
  19. //
  20. // The information in this file is provided for the exclusive use of the
  21. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  22. // and incorporate this code into other products for purposes authorized
  23. // by the Alias|Wavefront license agreement, without fee.
  24. //
  25. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  26. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  27. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  28. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  29. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  30. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  31. // PERFORMANCE OF THIS SOFTWARE.
  32. //
  33. //
  34. //  Alias|Wavefront Script File
  35. //  MODIFY THIS AT YOUR OWN RISK
  36. //
  37. //  Creation Date:  Jan 20, 2000
  38. //
  39. //    Author:            Kevin Smith
  40. //
  41. //  Description:
  42. //     Script to register UI action  with clip editor
  43. //    within it.
  44. //
  45. //  Input Arguments:
  46. //      None.
  47. //
  48. //  Return Value:
  49. //      None.
  50. //
  51.  
  52.  
  53. ////////////////////////////////////////////////////////////////////////
  54. //
  55. // Description:
  56. //     Action called when <backspace> key is pressed
  57. //
  58. //
  59. ////////////////////////////////////////////////////////////////////////
  60. global proc
  61. clipEditorDeleteCmd( string $editor )
  62. {
  63.     doRemoveClipArgList 1 { $editor, "0" };
  64. }
  65.  
  66. ////////////////////////////////////////////////////////////////////////
  67. //
  68. // Description:
  69. //     Action called when clip is dropped in TraX
  70. //
  71. //
  72. ////////////////////////////////////////////////////////////////////////
  73. global proc
  74. clipDropCmd( string $editor, string $clip, string $character, string $track, 
  75.              string $startTime )
  76. {
  77.     string $cmd;
  78.  
  79.     int $isPose = `getAttr ($clip+".pose")`;
  80.     
  81.     // We need to copy and paste if the clip is not already mapped to this
  82.     // character. But if it is already on the character, we can just
  83.     // instance it.
  84.     //
  85.     int $copyPasteNeeded = 1;
  86.     string $clipChars[] = `clip -q -ch $clip`;
  87.     string $clipChar;
  88.     for ($clipChar in $clipChars) {
  89.         if ($clipChar == $character) {
  90.             $copyPasteNeeded = 0;
  91.             break;
  92.         }
  93.     }
  94.  
  95.     float  $ftrack = $track;
  96.  
  97.     if ($copyPasteNeeded) {
  98.         // copy and paste by node name by default
  99.         //
  100.         string $mapMethod = "byNodeName";
  101.         string $map;
  102.         if (size($clipChars) == 1) {
  103.             $map = `characterMap -q $clipChars[0] $character`;
  104.             if (size($map)) {
  105.                 // if a character map exists, use the character map
  106.                 //
  107.                 $mapMethod = "byCharacterMap";
  108.             }
  109.         }
  110.         $cmd = ("clip -copy "+$clip+"; clip -paste -sc 1 -absolute 1 -s "+$startTime+" -mm \""+$mapMethod+"\" "+$character);
  111.     } else {
  112.         for ($clipChar in $clipChars) {
  113.             string $scheduler = `character -q -sc $clipChar`;
  114.             $cmd += ("clipSchedule -instance "+$clip+" -start "+$startTime);
  115.             if ($clipChar == $character) {
  116.                 $cmd += (" -track "+$ftrack);
  117.             }
  118.             $cmd += (" "+$scheduler+";");
  119.         }
  120.     }
  121.     evalEcho($cmd);
  122. }
  123.  
  124. //
  125. // Register UI actions with the clip editor. These are mel proc commands 
  126. // that get called when UI events happen in the clip editor.
  127. //
  128. global proc
  129. clipEditorRegisterActions ( string $editor )
  130. {
  131.     // Delete Key
  132.     clipEditor -e 
  133.         -deleteCmd                clipEditorDeleteCmd
  134.         $editor;
  135.     // Node drop on track
  136.     clipEditor -e 
  137.         -clipDropCmd            clipDropCmd
  138.         $editor;
  139. }
  140.